import { EntitySchema } from '@mikro-orm/core';

export class LeTaskScore {
  id!: string;
  taskId!: string;
  orderId!: string;
  orderSn?: string;
  UID!: string;
  startTime!: string;
  status: number = 1;
  number!: string;
  remark?: string;
  identifier?: string;
  type!: string;
  isDeleted?: number = 0;
  createdTime?: number = 0;
  updatedTime?: number = 0;
  deletedTime?: number = 0;
}

export const LeTaskScoreSchema = new EntitySchema({
  class: LeTaskScore,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    taskId: { type: 'string', columnType: 'bigint' },
    orderId: { type: 'string', columnType: 'bigint', defaultRaw: `0` },
    orderSn: { type: 'string', length: 50, nullable: true },
    UID: { type: 'string', fieldName: 'UID', columnType: 'bigint' },
    startTime: { type: 'string', columnType: 'bigint', defaultRaw: `0` },
    status: { type: 'number', columnType: 'tinyint', default: 1 },
    number: { type: 'string', columnType: 'bigint', defaultRaw: `1` },
    remark: { type: 'string', length: 255, nullable: true },
    identifier: { type: 'string', length: 30, nullable: true },
    type: { type: 'string', length: 3, default: 'add' },
    isDeleted: { type: 'number', columnType: 'tinyint', nullable: true, default: 0 },
    createdTime: { type: 'number', nullable: true, default: 0 },
    updatedTime: { type: 'number', nullable: true, default: 0 },
    deletedTime: { type: 'number', nullable: true, default: 0 },
  },
});
